package com.heima.wemedia.job;

import com.heima.common.wemedia.WemediaArticle163Constants;
import com.heima.wemedia.service.ReptilesArticleService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Log4j2
public class ReptilesArticleJob {
    @Autowired
    ReptilesArticleService reptilesArticleService;

    @XxlJob("reptilesArticleJob")
    public ReturnT<String> reptilesArticle(String param) throws Exception {
        log.info("爬取网易娱乐频道...");
        reptilesArticleService.CrawlWeMediaArticles(WemediaArticle163Constants.AMUSEMENT_CHANNEL);
        log.info("爬取网易直播频道...");
        reptilesArticleService.CrawlWeMediaArticles(WemediaArticle163Constants.BROADCAST_CHANNEL);
        log.info("爬取网易游戏频道...");
        reptilesArticleService.CrawlWeMediaArticles(WemediaArticle163Constants.GAME_CHANNEL);
        log.info("爬取网易抗疫频道...");
        reptilesArticleService.CrawlWeMediaArticles(WemediaArticle163Constants.ANTI_EPIDEMIC_CHANNEL);
        return ReturnT.SUCCESS;
    }
}